package com.yuanfengerp.customerexpenses.controller;


import com.yuanfengerp.customerexpenses.model.CustomerExpensesInfo;
import com.yuanfengerp.customerexpenses.service.impl.CustomerExpensesServiceImpl;
import com.yuanfengerp.publicUtil.Result;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@RestController
//@Repository
@CrossOrigin
public class CustomerExpensesController {
    @Autowired
    private CustomerExpensesServiceImpl cesi;
//    @GetMapping("/selectAllCustomerExpenses")
//    public Result<List<CustomerExpensesInfo>> selectAllCustomerExpenses(@Param("pageSize") Integer pageSize, @Param("pageNum") Integer pageNum){
//        return cesi.selectAllCustomerExpenses(pageSize, pageNum);
//    }
    @PostMapping("/selectCustomerExpenses")
    public Result<List<CustomerExpensesInfo>> selectCustomerExpenses(@RequestBody Map<String,Object> params){
        return cesi.selectCustomerExpenses(params);
    }
    @PostMapping("/insertCustomerExpenses")
    public Result<String> insertCustomerExpenses(@RequestBody CustomerExpensesInfo customerExpensesInfo){
        return cesi.insertCustomerExpenses(customerExpensesInfo);
    }

    @PostMapping("/updateCustomerExpenses")
    public Result<String> updateCustomerExpenses(@RequestBody CustomerExpensesInfo customerExpensesInfo){
        return cesi.updateCustomerExpenses(customerExpensesInfo);
    }
    @PostMapping("/deleteCustomerExpenses")
    public Result<String> deleteCustomerExpenses(String customer_expenses_ID){
        return cesi.deleteByPrimaryKey(customer_expenses_ID);
    }
    @PostMapping("/batchdeleteCustomerExpenses")
    public Result<String> batchdeleteCustomerExpenses(ArrayList<String> customer_expenses_IDs){
        return cesi.batchdelete(customer_expenses_IDs);
    }
    @PostMapping("/batchreviewCustomerExpenses")
    public Result<String> batchreviewCustomerExpenses(ArrayList<String> customer_expenses_IDs){
        return cesi.batchreview(customer_expenses_IDs);
    }

    @PostMapping("/selectCustomerExpensesItems")
    public Result<List<CustomerExpensesInfo>> selectCustomerExpensesItems(String customer_expense_ID){
        return cesi.selectCustomerExpensesItems(customer_expense_ID);
    }
}
